import request from '@/router/axios';

export const getList = (current, size, params) => {
  return request({
    url: '/api/blade-courtTime/courtTime/list',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
}

// 根据球场和日期查询场次 { courtId: '球场id', date: '日期, 默认当天' }
export const getListByCourt = (current, size, params) => {
  return request({
    url: '/api/blade-courtTime/courtTime/listByCourtAndDate',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
}

export const getDetail = (id) => {
  return request({
    url: '/api/blade-courtTime/courtTime/detail',
    method: 'get',
    params: {
      id
    }
  })
}

// 移除场次接口
export const remove = (ids) => {
  return request({
    url: '/api/blade-courtTime/courtTime/remove',
    method: 'post',
    params: {
      ids,
    }
  })
}

// 添加接口
export const add = (row) => {
  return request({
    url: '/api/blade-courtTime/courtTime/submit',
    method: 'post',
    data: row
  })
}

// 更新场次接口
export const update = (row) => {
  return request({
    url: '/api/blade-courtTime/courtTime/submit',
    method: 'post',
    data: row
  })
}

// 批量保存场次
export const saveBatchTime = (data) => {
  return request({
    url: '/api/blade-courtTime/courtTime/saveBatchTime',
    method: 'post',
    data
  })
}

